﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using com.cruxomatic.views.Common;
using com.cruxomatic.DTOs.Configuration;

public partial class Controls_Common_ErrorNotification : System.Web.UI.UserControl, IError
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }

    public ErrorInformation ErrorInformation
    {
        get
        {
            ErrorInformation errorInformation = new ErrorInformation();
            errorInformation.ErrorNameOrCode = lblErrorCode.Text;
            errorInformation.ErrorDescription = lblErrorDescription.Text;
            errorInformation.ProbableCause = lblProbableCause.Text;
            errorInformation.ShortDescription = lblShortDescription.Text;
            errorInformation.RecommendedAction = lblRecommendedAction.Text;
            return errorInformation;
        }
        set
        {
            if (value != null)
            {
                pnlError.Visible = true;
                lblErrorCode.Text = LocalizationManager.GetLocalizedText(value.ErrorNameOrCode);
                lblShortDescription.Text = LocalizationManager.GetLocalizedText(value.ShortDescription);
                lblErrorDescription.Text = LocalizationManager.GetLocalizedText(value.ErrorDescription);
                lblProbableCause.Text = LocalizationManager.GetLocalizedText(value.ProbableCause);
                lblRecommendedAction.Text = LocalizationManager.GetLocalizedText(value.RecommendedAction);
            }
            else
            {
                pnlError.Visible = false;
                
            }
        }
    }


    #region IError Members

    public string ErrorCode
    {
        get {
            if (ErrorInformation != null) return ErrorInformation.ErrorNameOrCode;
            else return "";
        }
    }

    #endregion
}
